package day14.KeJian;
/*- 定义一个类MyThread继承Thread类
- 在MyThread类中重写run()方法
- 创建MyThread类的对象
- 启动线程*/
public class MyThread extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(i);
        }
    }
}
class MyThreadDemo{
    public static void main(String[] args) {
        MyThread m1 = new MyThread();
        MyThread m2 = new MyThread();
        //void run()在线程开启后，此方法将被调用执行
        //m1.run();
        //m2.run();
        //void start()使此线程开始执行，Java虚拟机会调用run方法()
        m1.start();
        m2.start();
    }
}